#!/usr/bin/python

import regex
import re
import sys


level0 = regex.get_all_url('');
#for item in level0:
#	print item;
#sys.exit(0);


level1_mp3=[];
regex_mp3='\.mp3$';
for item in level0:
	level1=regex.get_all_url(item);
	for lv1_item in level1:
		if re.search(regex_mp3, lv1_item) is not None:
			level1_mp3.append(lv1_item);


# download this mp3
regex_mp3_name='([^/]*\.mp3$)';
for url in level1_mp3:
	print url;
	m=re.search(regex_mp3_name,url);
	filename=m.group(0);
	print filename + ' downloading ...';
	regex.download(url,filename,True);
	
print '===end===';
